package ooww.ssww.strong.junk;

import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
// /import android.content.pm.IPackageStatsObserver;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
// /import android.content.pm.PackageStats;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.graphics.drawable.Drawable;
import android.os.Debug;
import android.os.Environment;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;
import h.BJ;
import ooww.ssww.normal.constants.ByteConstants;
import ooww.ssww.normal.constants.ScanState;
import ooww.ssww.strong.datacenter.DataCenterObserver;
import ooww.ssww.strong.junk.alert.CleanAlert;
import ooww.ssww.strong.junk.clearstrategy.ClearManager;
import ooww.ssww.strong.junk.mode.InstalledApp;
import ooww.ssww.strong.junk.mode.InstalledAppAndRAM;
import ooww.ssww.strong.junk.mode.JunkChild;
import ooww.ssww.strong.junk.mode.JunkChildApk;
import ooww.ssww.strong.junk.mode.JunkChildCache;
import ooww.ssww.strong.junk.mode.JunkChildCacheOfChild;
import ooww.ssww.strong.junk.mode.JunkChildResidual;
import ooww.ssww.strong.junk.mode.JunkGroup;
import ooww.ssww.strong.junk.notifycationmanager.NotificationManager2345;
import ooww.ssww.strong.utils.CommenContext;
import iiww.ssww.mmww.clean.util.CleanSetSharedPreferences;
import ooww.ssww.strong.utils.FileTreeUtils;
import ooww.ssww.strong.utils.FormatUtils;
import ooww.ssww.strong.utils.SecurityAppInfo;
import ooww.ssww.strong.utils.Util;
import ooww.ssww.strong.utils.Utils;
import ooww.ssww.strong.utils.WeChatUtil;
import ooww.ssww.strong.wechat.MTask;
import com.umeng.analytics.MobclickAgent;
import ooww.ssww.normal.db.CleanTrustDBManager;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;

/**
 * Created by Administrator on 2015/1/15.
 */
public class ScanHelp implements Parcelable {

    private static final String TAG = "ScanHelp";

    public static final long ONE_DAY_LONG = 24 * 60 * 60 * 1000;

    // 扫描文件的深度
    private static final int SCAN_FILE_OVER = 6;

    // 全不选中状态
    public static final int STATE_UNALL_SELECT = 0;

    // 全选中状态
    public static final int STATE_ALL_SELECT = 1;

    // 半选中状态
    public static final int STATE_HALF_SELECT = 2;

    public static final String RAM_QUICKEN = "内存加速";

    public static final String CACHE_JUNK = "缓存垃圾";

    public static final String SYATEM_CACHE = "系统缓存";

    public static final String UNINSTALL_REMAIN = "卸载残留";

    public static final String APK_FIAL = "无用安装包";

    private static final String filterDir1 = "/一键清理/";

    private static final String filterDir2 = "/onekeyclean/";

    private static final String selectSql = "select a.encrypted_file_path,a.encrypted_file_desp,a.encrypted_file_tip,a.proposal," + "b.encrypted_pck_name,b.encrypted_app_name,b.encrypted_tip " + "from file_table as a join package_table as b " + "on a.pck_name_id = b._id " + "where b.encrypted_pck_name = ?";

    private static final String WeiXin_PackageName = "com.tencent.mm";

    // 必须是32个×
    private static final String WeiXin_Match = "********************************";

    private static ScanHelp mInstance;

    private Context context;

    private SQLiteDatabase db;

    private boolean isRun;

    private ActivityManager am;

    private List<JunkGroup> datas;

    private List<JunkChild> cacheDatas;

    private List<JunkChild> residualDatas;

    private List<JunkChild> apkFileDatas;

    private List<JunkChild> ramDatas;

    private List<JunkChildCacheOfChild> cacheSystemDatas;

    // 扫描回调
    private IScanResult iScanResult;

    private Collection<InstalledApp> collection;

    private long cacheSystemSize;

    private long cacheSize;

    private long residualSize;

    private long apkSize;

    private long ramSize = 0;

    private PackageManager pm;

    private List<TrustMode> queryAll;

    private String sdPath;

    private String outSdPath;

    private ClearManager clearManager;

    private long lastTime = 0;

    private boolean mHadScan = false;

    private ScanHelp(Context context) {
        Log.d("MyHandler", "crate Scan:" + "--" + this.hashCode());
        this.context = context.getApplicationContext();
    }

    protected ScanHelp(Parcel in) {
        isRun = in.readByte() != 0;
        cacheSystemSize = in.readLong();
        cacheSize = in.readLong();
        residualSize = in.readLong();
        apkSize = in.readLong();
        ramSize = in.readLong();
        sdPath = in.readString();
        outSdPath = in.readString();
        lastTime = in.readLong();
    }

    public static final Creator<ScanHelp> CREATOR = new Creator<ScanHelp>() {

        @Override
        public ScanHelp createFromParcel(Parcel in) {
            int passwordfdare32432qresafdsagda32 = 123456;
            int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
            for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
                int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
                while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                    arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                    jfdsaipureqwrewq7843791298047ui--;
                }
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
            }
            return new ScanHelp(in);
        }

        @Override
        public ScanHelp[] newArray(int size) {
            int passwordfdare32432qresafdsagda32 = 123456;
            int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
            for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
                int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
                while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                    arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                    jfdsaipureqwrewq7843791298047ui--;
                }
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
            }
            return new ScanHelp[size];
        }
    };

    public static ScanHelp getInstance(Context context) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        /*if (mInstance != null) {
            mInstance = null;
        }
        mInstance = new ScanHelp(context);*/
        if (mInstance == null) {
            synchronized (ScanHelp.class) {
                if (mInstance == null) {
                    mInstance = new ScanHelp(context);
                }
            }
        }
        return mInstance;
    }

    public SQLiteDatabase getDb() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        return db;
    }

    public void setDb(SQLiteDatabase db) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        this.db = db;
    }

    public boolean isRun() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        return isRun;
    }

    public void setRun(boolean isRun) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        this.isRun = isRun;
    }

    public List<JunkGroup> getDatas() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        return datas;
    }

    public void setDatas(List<JunkGroup> datas) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        this.datas = datas;
    }

    public void setiScanResult(IScanResult iScanResult) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        this.iScanResult = iScanResult;
    }

    /**
     * 微信扫描 开始扫描
     *
     * @param flag 扫描的结果只需要大小 不需要具体的数据
     */
    public synchronized void startScan(final boolean flag) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        NotificationManager2345 manager = NotificationManager2345.getInstance(context);
        manager.cancelNotification(NotificationManager2345.NOTIFI_CLAEAN_2345);
        // MTask.BACKGROUND_EXECUTOR.execute(new Runnable() {
        MTask.sExecutor.execute(new Runnable() {

            @Override
            public void run() {
                int passwordfdare32432qresafdsagda32 = 123456;
                int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
                int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
                for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
                    int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
                    for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                        if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                            minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                        }
                    }
                    if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                        int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                        arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                        arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
                    }
                }
                android.os.Process.setThreadPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
                try {
                    if (flag) {
                        if (!BJ.class.getName().equals(Util.getCurrentTopActivity(context))) {
                            scanSize();
                        }
                    } else {
                        scanAll();
                    }
                } catch (Exception e) {
                    Log.i(TAG, e.toString());
                }
            }
        });
    }

    private void scanSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        initData();
        try {
            getSystemCache();
        } catch (Exception e) {
            e.printStackTrace();
        }
        getApkFile(true);
        getAppCache(true);
        getAppResidual(true);
        getRAMCache(true);
        long size = getTotalSize();
        long setSize = 100 * ByteConstants.MB;
        int setSizeIndex = CleanSetSharedPreferences.getLastSet(context, CleanSetSharedPreferences.CLEAN_SIZE_SET, 1);
        if (setSizeIndex == 0)
            setSize = 50 * ByteConstants.MB;
        else if (setSizeIndex == 1)
            setSize = 100 * ByteConstants.MB;
        else if (setSizeIndex == 2)
            setSize = 300 * ByteConstants.MB;
        else if (setSizeIndex == 3)
            setSize = 500 * ByteConstants.MB;
        if (size > setSize) {
            CleanAlert.notify(context, FormatUtils.formatFileSize(size));
        }
        CleanSetSharedPreferences.setPreviousScanSize(CommenContext.get(), size);
    }

    public long getTotalSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        Log.d(TAG, "cacheSystemSize:" + FormatUtils.formatFileSize(cacheSystemSize) + "/cacheSize:" + FormatUtils.formatFileSize(cacheSize) + "/residualSize :" + FormatUtils.formatFileSize(cacheSystemSize) + "/apkSize :" + FormatUtils.formatFileSize(apkSize) + "/ramSize:" + FormatUtils.formatFileSize(ramSize));
        return cacheSystemSize + cacheSize + residualSize + apkSize + ramSize;
    }

    /**
     * 判断是否在六秒内
     *
     * @return
     */
    private boolean checkLastScanTime() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        return System.currentTimeMillis() - DataCenterObserver.get(CommenContext.get()).getLastScanTime() <= 6000;
    }

    /**
     * 扫描数据
     */
    private void initDataFromScan() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        long start = System.currentTimeMillis();
        getApkFile(false);
        try {
            getSystemCache();
        } catch (Exception e) {
            e.printStackTrace();
        }
        getRAMCache(false);
        if (checkSDState()) {
            getAppCache(false);
            getAppResidual(false);
        }
        if (residualDatas.size() > 0) {
            JunkGroup group2 = new JunkGroup();
            group2.setName(UNINSTALL_REMAIN);
            group2.setSize(residualSize);
            group2.setChildrenItems(residualDatas);
            datas.add(group2);
            System.out.println("值------1:" + group2.toString());
        }
        if (apkFileDatas.size() > 0) {
            JunkGroup group3 = new JunkGroup();
            group3.setName(APK_FIAL);
            group3.setSize(apkSize);
            group3.setChildrenItems(apkFileDatas);
            datas.add(group3);
            System.out.println("值------2:" + group3.toString());
        }
        if (cacheSystemDatas.size() > 0) {
            JunkChildCache cache = new JunkChildCache();
            cache.select = 1;
            cache.size = cacheSystemSize;
            cache.tip = "建议清理";
            cache.name = SYATEM_CACHE;
            cache.packageName = JunkChildCache.systemCachePackName;
            Collections.sort(cacheSystemDatas, new Comparator<JunkChildCacheOfChild>() {

                @Override
                public int compare(JunkChildCacheOfChild lhs, JunkChildCacheOfChild rhs) {
                    int passwordfdare32432qresafdsagda32 = 123456;
                    int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
                    int keydasopuerqnfdazcveq = 4;
                    int lowupoeqfda7073fdal = 0;
                    int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
                    int middledaiueprnvznfewqip = 0;
                    if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
                        int adfajpouqregjbdipug = 1;
                    } else {
                        while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                            middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                            if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                                // 比关键字大则关键字在左区域
                                highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                            } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                                // 比关键字小则关键字在右区域
                                lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                            } else {
                            }
                        }
                    }
                    return Long.compare(rhs.size, lhs.size);
                }
            });
            cache.childCacheOfChild = cacheSystemDatas;
            cacheDatas.add(0, cache);
            System.out.println("值------3:" + cache.toString());
        }
        if (cacheDatas.size() > 0) {
            JunkGroup group1 = new JunkGroup();
            group1.setName(CACHE_JUNK);
            group1.setSize(cacheSize + cacheSystemSize);
            initCacheDatas();
            group1.setChildrenItems(cacheDatas);
            datas.add(0, group1);
            System.out.println("值------4:" + group1.toString());
        }
        if (ramDatas.size() > 0) {
            JunkGroup group4 = new JunkGroup();
            group4.setName(RAM_QUICKEN);
            group4.setSize(ramSize);
            group4.setChildrenItems(ramDatas);
            group4.setSelect(1);
            Collections.sort(ramDatas, new Comparator<JunkChild>() {

                @Override
                public int compare(JunkChild lhs, JunkChild rhs) {
                    int passwordfdare32432qresafdsagda32 = 123456;
                    int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
                    int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
                    for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
                        int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
                        for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                            if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                                minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                            }
                        }
                        if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                            int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                            arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                            arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
                        }
                    }
                    if (lhs instanceof InstalledAppAndRAM && rhs instanceof InstalledAppAndRAM) {
                        InstalledAppAndRAM ram1 = (InstalledAppAndRAM) lhs;
                        InstalledAppAndRAM ram2 = (InstalledAppAndRAM) rhs;
                        return Integer.compare(ram2.getApp().flag, ram1.getApp().flag);
                    }
                    return 0;
                }
            });
            datas.add(0, group4);
            System.out.println("值------5:" + group4.toString());
        }
        // 扫描时间不足6秒的话 等待满足6秒再结束
        if (System.currentTimeMillis() - start <= 6000 && isRun) {
            try {
                Thread.sleep(6000 - (System.currentTimeMillis() - start));
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
        this.setRun(false);
        callCleanActivity(ScanState.SCAN_ALL_END);
    }

    /**
     * 初始化 cache的选中状态
     */
    private void initCacheDatas() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        if (cacheDatas != null && cacheDatas.size() > 0) {
            for (JunkChild child : cacheDatas) {
                if (child instanceof JunkChildCache) {
                    initCacheDataList((JunkChildCache) child);
                }
            }
        }
    }

    /**
     * 初始化数据的选中状态
     *
     * @param child
     */
    private void initCacheDataList(JunkChildCache child) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        List<JunkChildCacheOfChild> list = child.childCacheOfChild;
        if (list != null && list.size() > 0) {
            JunkChildCacheOfChild childOfChild = list.get(0);
            if (STATE_ALL_SELECT == childOfChild.getSelect()) {
                // index 0 处于选中状态
                for (JunkChildCacheOfChild cc : list) {
                    if (0 == cc.getSelect()) {
                        // 半选中状态
                        child.setSelect(ScanHelp.STATE_HALF_SELECT);
                        return;
                    }
                }
                // 选中状态
                child.setSelect(ScanHelp.STATE_ALL_SELECT);
            } else {
                // index 0 处于非选中状态
                for (JunkChildCacheOfChild cc : list) {
                    if (1 == cc.getSelect()) {
                        // 半选中状态
                        child.setSelect(ScanHelp.STATE_HALF_SELECT);
                        return;
                    }
                }
                // 选中状态
                child.setSelect(ScanHelp.STATE_UNALL_SELECT);
            }
        }
    }

    private void scanAll() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        initData();
        if (checkLastScanTime()) {
            initDataFromStatic();
        } else {
            initDataFromScan();
        }
    }

    private void initData() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        sdPath = Util.getSDPath();
        outSdPath = Util.getOutSDPath();
        queryAll = new CleanTrustDBManager(context).queryAll();
        pm = context.getPackageManager();
        cacheSystemSize = 0;
        cacheSize = 0;
        residualSize = 0;
        apkSize = 0;
        ramSize = 0;
        collection = DataCenterObserver.get(context).getInstalledApps().values();
        datas = new ArrayList<JunkGroup>();
        datas.clear();
        cacheDatas = new ArrayList<JunkChild>();
        cacheDatas.clear();
        cacheSystemDatas = new ArrayList<JunkChildCacheOfChild>();
        cacheSystemDatas.clear();
        residualDatas = new ArrayList<JunkChild>();
        residualDatas.clear();
        apkFileDatas = new ArrayList<JunkChild>();
        apkFileDatas.clear();
        ramDatas = new ArrayList<JunkChild>();
        ramDatas.clear();
        clearManager = new ClearManager(context);
    }

    /**
     * 创建数据从MarkApplication中
     */
    private void initDataFromStatic() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        datas = DataCenterObserver.get(CommenContext.get()).getJunkDataList();
        if (datas == null || datas.size() == 0) {
            datas = new ArrayList<JunkGroup>();
            initDataFromScan();
        } else {
            for (JunkGroup group : datas) {
                if (RAM_QUICKEN.equals(group.getName())) {
                    ramDatas = group.getChildrenItems();
                    for (JunkChild child : ramDatas) {
                        ramSize += child.size;
                    }
                } else if (APK_FIAL.equals(group.getName())) {
                    apkFileDatas = group.getChildrenItems();
                    for (JunkChild child : apkFileDatas) {
                        apkSize += child.size;
                    }
                } else if (UNINSTALL_REMAIN.equals(group.getName())) {
                    residualDatas = group.getChildrenItems();
                    for (JunkChild child : residualDatas) {
                        residualSize += child.size;
                    }
                } else if (CACHE_JUNK.equals(group.getName())) {
                    cacheDatas = group.getChildrenItems();
                    for (JunkChild child : cacheDatas) {
                        if (child instanceof JunkChildCache) {
                            JunkChildCache cache = (JunkChildCache) child;
                            if (JunkChildCache.systemCachePackName.equals(cache.packageName)) {
                                cacheSystemDatas = cache.childCacheOfChild;
                                for (JunkChildCacheOfChild cc : cacheSystemDatas) {
                                    cacheSystemSize += cc.size;
                                }
                            } else {
                                cacheSize += cache.size;
                            }
                        }
                    }
                }
            }
            callCleanActivity(ScanState.SCAN_RAM_END);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            callCleanActivity(ScanState.SCAN_ALL_END);
        }
    }

    // /@SuppressLint("NewApi")
    private void getSystemCache() throws Exception {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        for (final InstalledApp app : collection) {
            callCleanActivity(app.appName);
            if (isRun == false)
                return;
            // /           Method method = pm.getClass().getMethod("getPackageSizeInfo", String.class, IPackageStatsObserver.class);
            // /           method.invoke(pm, app.packageName, new IPackageStatsObserver.Stub() {
            // @Override
            // public void onGetStatsCompleted(PackageStats pStats, boolean succeeded) throws RemoteException {
            // if (succeeded) {
            // long cacheSize1 = pStats.cacheSize;
            // long cacheSize2 = 0;
            // cacheSize2 = pStats.externalCacheSize;
            // long cacheSize = cacheSize1 + cacheSize2;
            // if (cacheSize > 24 * 1024) {
            // try {
            // pm.getApplicationInfo(app.packageName, 0);
            // JunkChildCacheOfChild childOfChild = new JunkChildCacheOfChild();
            // childOfChild.size = cacheSize;
            // childOfChild.type = JunkChildCacheOfChild.SYSTEM_CACHE;
            // childOfChild.name = app.appName;
            // childOfChild.packageName = app.packageName;
            // childOfChild.select = 1;
            // Drawable icon = pm.getApplicationIcon(pm.getApplicationInfo(app.packageName, 0));
            // childOfChild.icon = icon;
            // //                                System.out.println("值------:"+icon);
            // cacheSystemDatas.add(childOfChild);
            // //                                System.out.println("值------:" + childOfChild.toString());
            // cacheSystemSize += cacheSize;
            // } catch (Exception e) {
            // System.out.println("值------:崩溃了");
            // e.printStackTrace();
            // }
            // 
            // }
            // }
            // }
            // });
        }
        callCleanActivity(ScanState.SCANING_SYSTEM_CACHE_END);
    }

    /**
     * 扫描app缓存
     */
    private void getAppCache(boolean onlySize) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        List<String> mm_path_matchs = WeChatUtil.MMPaths;
        if (db != null && db.isOpen()) {
            // 得到手机中用户app
            Collection<InstalledApp> userApps = DataCenterObserver.get(context).getUserInstalledApps().values();
            for (InstalledApp app : userApps) {
                if (isRun == false)
                    return;
                if (checkTrust(app.packageName))
                    /*检查白名单的包名*/
                    continue;
                List<JunkChildCacheOfChild> result = new ArrayList<JunkChildCacheOfChild>();
                callCleanActivity(app.packageName);
                Log.d(TAG, "ScanHelp#getAppCache");
                byte[] solidKey = SecurityAppInfo.getSolidKey(context);
                if (solidKey == null) {
                    break;
                }
                String encryptedName = Utils.strCode(app.packageName, new String(solidKey)).trim();
                Log.d(TAG, "getAppCache: ");
                Cursor filePathCursor = db.rawQuery(selectSql, new String[] { encryptedName });
                long size = 0;
                String tip = "";
                int count = 0;
                while (filePathCursor.moveToNext()) {
                    Log.d(TAG, "getAppCache: " + count++);
                    if (isRun == false) {
                        filePathCursor.close();
                        return;
                    }
                    tip = ClearManager.decrptString(filePathCursor.getString(filePathCursor.getColumnIndex("encrypted_tip")));
                }
                if (filePathCursor != null) {
                    filePathCursor.close();
                }
                if (size > 0) {
                    cacheSize += size;
                    if (onlySize == false) {
                        JunkChildCache cache = new JunkChildCache();
                        cache.childCacheOfChild = result;
                        cache.select = 1;
                        for (JunkChildCacheOfChild childOfChild : result) {
                            if (childOfChild.getSelect() == 0) {
                                cache.select = 0;
                                break;
                            }
                        }
                        cache.size = size;
                        cache.tip = tip;
                        cache.packageName = app.packageName;
                        cache.name = app.appName;
                        Drawable icon;
                        try {
                            icon = pm.getApplicationIcon(pm.getApplicationInfo(app.packageName, 0));
                            cache.icon = icon;
                        } catch (PackageManager.NameNotFoundException e) {
                            e.printStackTrace();
                            MobclickAgent.reportError(CommenContext.get(), e.fillInStackTrace());
                        }
                        cacheDatas.add(cache);
                    }
                }
            }
            // 扫描广告小分类
            scanADSDK(onlySize);
            callCleanActivity(ScanState.SCANING_APP_CACHE_END);
        }
    }

    /**
     * 扫描广告和小分类
     *
     * @param flag true 只要大小 不要数据
     */
    private void scanADSDK(boolean flag) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        if (db != null) {
            String sql = "select * from package_table where type=1";
            String sql2 = "select * from file_table where pck_name_id= ?";
            if (!db.isOpen()) {
                db = null;
                db = clearManager.openClearDatabase();
            }
            Cursor cursor = db.rawQuery(sql, null);
            while (cursor.moveToNext()) {
                if (isRun == false) {
                    cursor.close();
                    return;
                }
                String appName = ClearManager.decrptString(cursor.getString(cursor.getColumnIndex("encrypted_app_name")));
                if (TextUtils.isEmpty(appName)) {
                    break;
                }
                String packageName = ClearManager.decrptString(cursor.getString(cursor.getColumnIndex("encrypted_pck_name")));
                String tip = ClearManager.decrptString(cursor.getString(cursor.getColumnIndex("encrypted_tip")));
                if (checkTrust(packageName)) {
                    continue;
                }
                callCleanActivity(appName);
                int _id = cursor.getInt(cursor.getColumnIndex("_id"));
                if (!db.isOpen()) {
                    db = null;
                    db = clearManager.openClearDatabase();
                }
                List<JunkChildCacheOfChild> childCacheOfChilds = new ArrayList<JunkChildCacheOfChild>();
                Cursor cursor2 = db.rawQuery(sql2, new String[] { _id + "" });
                long size = 0;
                while (cursor2.moveToNext()) {
                    if (isRun == false) {
                        cursor2.close();
                        return;
                    }
                    String filePath = ClearManager.decrptString(cursor2.getString(cursor2.getColumnIndex("encrypted_file_path")));
                    if (checkPathExistNotContainFolder(sdPath, filePath)) {
                        filePath = sdPath + filePath;
                    } else if (checkPathExistNotContainFolder(outSdPath, filePath)) {
                        filePath = outSdPath + filePath;
                    } else {
                        continue;
                    }
                    String filename = ClearManager.decrptString(cursor2.getString(cursor2.getColumnIndex("encrypted_file_desp")));
                    String fileTip = ClearManager.decrptString(cursor2.getString(cursor2.getColumnIndex("encrypted_file_tip")));
                    int proposal = cursor2.getInt(cursor2.getColumnIndex("proposal"));
                    long fileSize = getPathFileSize(filePath);
                    JunkChildCacheOfChild childOfChild = new JunkChildCacheOfChild();
                    childOfChild.type = JunkChildCacheOfChild.APP_CACHE;
                    childOfChild.fileTip = fileTip;
                    childOfChild.select = proposal;
                    childOfChild.size = fileSize;
                    childOfChild.name = filename;
                    childOfChild.packageName = packageName;
                    childOfChild.path = filePath;
                    childCacheOfChilds.add(childOfChild);
                    size += fileSize;
                }
                if (childCacheOfChilds.size() > 0) {
                    cacheSize += size;
                    if (flag == false) {
                        JunkChildCache cache = new JunkChildCache();
                        cache.name = appName;
                        cache.size = size;
                        cache.select = 1;
                        cache.packageName = packageName;
                        cache.tip = tip;
                        cache.childCacheOfChild = childCacheOfChilds;
                        cacheDatas.add(cache);
                    }
                }
                if (cursor2 != null)
                    cursor2.close();
            }
            if (cursor != null)
                cursor.close();
        }
    }

    /**
     * 扫描 app残留
     */
    private void getAppResidual(boolean onlySize) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        if (db != null) {
            String sql = "select * from package_table where type=0";
            String sql2 = "select * from file_table where pck_name_id= ?";
            if (!db.isOpen()) {
                db = null;
                db = clearManager.openClearDatabase();
            }
            Cursor cursor = db.rawQuery(sql, null);
            while (cursor != null && cursor.moveToNext()) {
                if (!isRun) {
                    cursor.close();
                    return;
                }
                String appName = ClearManager.decrptString(cursor.getString(cursor.getColumnIndex("encrypted_app_name")));
                String packageName = ClearManager.decrptString(cursor.getString(cursor.getColumnIndex("encrypted_pck_name")));
                if (checkPackageNameExists(packageName)) {
                    // 手机上存在该包名 则是 不是残留
                    continue;
                }
                if (checkTrust(packageName)) {
                    continue;
                }
                callCleanActivity(packageName);
                int _id = cursor.getInt(cursor.getColumnIndex("_id"));
                if (!db.isOpen()) {
                    db = null;
                    db = clearManager.openClearDatabase();
                }
                Cursor cursor2 = db.rawQuery(sql2, new String[] { _id + "" });
                long size = 0;
                List<String> paths = new ArrayList<String>();
                while (cursor2.moveToNext()) {
                    if (isRun == false) {
                        cursor2.close();
                        return;
                    }
                    String filePath = ClearManager.decrptString(cursor2.getString(cursor2.getColumnIndex("encrypted_file_path")));
                    if (checkPathExist(sdPath, filePath)) {
                        filePath = sdPath + filePath;
                    } else if (checkPathExist(outSdPath, filePath)) {
                        filePath = outSdPath + filePath;
                    } else {
                        continue;
                    }
                    paths.add(filePath);
                    long fileSize = getPathFileSize(filePath);
                    size += fileSize;
                }
                if (paths.size() > 0) {
                    residualSize += size;
                    if (onlySize == false) {
                        JunkChildResidual residual = new JunkChildResidual();
                        residual.name = appName;
                        residual.paths = paths;
                        residual.size = size;
                        residual.select = 1;
                        residual.packageName = packageName;
                        residualDatas.add(residual);
                    }
                }
                if (cursor2 != null)
                    cursor2.close();
            }
            if (cursor != null)
                cursor.close();
            clearManager.closeClearDatabase(db);
            callCleanActivity(ScanState.SCANING_RESIDUAL_END);
        }
    }

    /**
     * 扫描内存占用
     */
    private void getRAMCache(boolean onlySize) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        if (System.currentTimeMillis() - InstalledAppAndRAM.lastCleanTime < 3 * 60 * 1000) {
            try {
                Thread.sleep(2000);
                callCleanActivity(ScanState.SCAN_RAM_END);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            return;
        }
        am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningAppProcessInfo> RAPIS = getRAPI();
        for (ActivityManager.RunningAppProcessInfo rapi : RAPIS) {
            callCleanActivity(rapi.processName);
            if (isRun == false)
                return;
            int uid = rapi.uid;
            int[] myMempid = new int[] { rapi.pid };
            Debug.MemoryInfo[] memoryInfo = am.getProcessMemoryInfo(myMempid);
            int memSize = memoryInfo[0].getTotalPrivateDirty() * 1024;
            if (onlySize == false) {
                InstalledAppAndRAM ram = getContainFromUid(uid);
                if (ram == null) {
                    InstalledAppAndRAM app = getAppFromUid(uid);
                    if (app != null && memSize > 0) {
                        app.size = memSize;
                        ramSize += memSize;
                        try {
                            app.icon = pm.getApplicationIcon(pm.getApplicationInfo(rapi.processName, 0));
                            System.out.println("值------0:" + app.toString());
                        } catch (PackageManager.NameNotFoundException e) {
                            e.printStackTrace();
                        }
                        ramDatas.add(app);
                    }
                } else {
                    ramSize += memSize;
                    ram.size = ram.size + memSize;
                }
            } else {
                ramSize += memSize;
            }
        }
        callCleanActivity(ScanState.SCAN_RAM_END);
    }

    /**
     * 扫描全盘apk文件
     */
    private void getApkFile(boolean onlySize) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        // 扫描内部sd卡
        if (!TextUtils.isEmpty(sdPath)) {
            File file = Environment.getExternalStorageDirectory();
            findApkFile(file, onlySize);
        }
        // 扫描外部sd卡
        if (!TextUtils.isEmpty(outSdPath)) {
            File file = new File(outSdPath);
            if (file.exists()) {
                findApkFile(file, onlySize);
            }
        }
        callCleanActivity(ScanState.SCANING_APK_FILE_END);
    }

    /**
     * 检查对应路径的文件是否存在，path和根路径 如果目录是空文件夹则不存在
     *
     * @param path
     * @return
     */
    private boolean checkPathExistNotContainFolder(String dir, String path) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        if (TextUtils.isEmpty(path) || TextUtils.isEmpty(dir)) {
            return false;
        }
        File file = new File(dir, path);
        if (file.exists()) {
            if (file.isFile())
                return true;
            else {
                File[] files = file.listFiles();
                if (files != null && files.length > 0) {
                    return true;
                }
                return false;
            }
        }
        return false;
    }

    /**
     * 检查对应路径的文件是否存在，path和根路径  不论是否空文件夹
     *
     * @param path
     * @return
     */
    private boolean checkPathExist(String dir, String path) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        if (TextUtils.isEmpty(path)) {
            return false;
        }
        File file = new File(dir, path);
        if (file.exists()) {
            if (file.isFile())
                return true;
            else {
                File[] files = file.listFiles();
                if (files != null) {
                    return true;
                }
            }
        }
        return false;
    }

    /**
     * 获取全部的运行进程信息
     *
     * @return
     */
    private List<ActivityManager.RunningAppProcessInfo> getRAPI() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        List<ActivityManager.RunningAppProcessInfo> mRunningPros = am.getRunningAppProcesses();
        return mRunningPros;
    }

    /**
     * 查询内存垃圾中是否已经包含uid的项
     * 包含的话则返回 不包含返回null;
     *
     * @param uid
     * @return
     */
    private InstalledAppAndRAM getContainFromUid(int uid) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        for (JunkChild item : ramDatas) {
            if (item instanceof InstalledAppAndRAM) {
                InstalledAppAndRAM ram = (InstalledAppAndRAM) item;
                if (ram.getApp().uid == uid) {
                    return ram;
                }
            }
        }
        return null;
    }

    /**
     * 从手机的全部应用集合中找到对应uid的app
     *
     * @param uid
     * @return
     */
    private InstalledAppAndRAM getAppFromUid(int uid) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        for (InstalledApp item : collection) {
            if (item.uid == uid) {
                InstalledAppAndRAM iaar = new InstalledAppAndRAM(item);
                // item.flag;//flag 代替选择
                iaar.select = 1;
                iaar.name = item.appName;
                return iaar;
            }
        }
        return null;
    }

    /**
     * 判断该应用在手机中的安装情况
     *
     * @param pm          PackageManager
     * @param packageName 要判断应用的包名
     * @param versionCode 要判断应用的版本号
     */
    private int doType(PackageManager pm, String packageName, int versionCode) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        List<PackageInfo> pakageinfos = pm.getInstalledPackages(PackageManager.GET_UNINSTALLED_PACKAGES);
        for (PackageInfo pi : pakageinfos) {
            String pi_packageName = pi.packageName;
            int pi_versionCode = pi.versionCode;
            // 如果这个包名在系统已经安装过的应用中存在
            if (packageName.equals(pi_packageName)) {
                // Log.i("test","此应用安装过了");
                if (versionCode == pi_versionCode) {
                    return JunkChildApk.INSTALLED;
                } else if (versionCode > pi_versionCode) {
                    return JunkChildApk.INSTALLED_UPDATE;
                } else if (versionCode < pi_versionCode) {
                    return JunkChildApk.INSTALLED_OLD;
                }
            }
        }
        return JunkChildApk.UNINSTALLED;
    }

    private void findApkFile(File file, boolean onlySize) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        if (isRun == false)
            return;
        if (file.exists() && file.canWrite()) {
            callCleanActivity(file.getAbsolutePath());
            if (checkTrust(file.getAbsolutePath())) {
                return;
            }
            if (file.isFile()) {
                String name_s = file.getName();
                String path = file.getAbsolutePath();
                System.out.println("path:" + path);
                try {
                    if (name_s.toLowerCase(Locale.getDefault()).endsWith(".apk") && checkOneKeyCleanFiler(path)) {
                        long size = file.length();
                        apkSize = apkSize + size;
                        if (onlySize == false) {
                            callCleanActivity(path);
                            JunkChildApk apk = getApkInfoFromPackageInfo(pm, path);
                            apk.fileTime = file.lastModified();
                            apk.path = file.getAbsolutePath();
                            apk.size = size;
                            apk.icon = pm.getApplicationIcon(pm.getPackageArchiveInfo(path, PackageManager.GET_ACTIVITIES).applicationInfo);
                            if (JunkChildApk.INSTALLED == apk.installedType) {
                                apk.select = 1;
                            } else {
                                long currentTime = System.currentTimeMillis();
                                if (currentTime - apk.fileTime < ONE_DAY_LONG) {
                                    apk.select = 0;
                                } else {
                                    apk.select = 1;
                                }
                            }
                            apkFileDatas.add(apk);
                        }
                    }
                } catch (Exception e) {
                    Log.i("Tagv", e.toString());
                }
            } else {
                if (isRun == false) {
                    return;
                }
                /*if (FileTreeUtils.isFileDirOver(file, SCAN_FILE_OVER)) {
                    //深度判断
                    return;
                }*/
                File[] files = file.listFiles();
                if (files != null && files.length > 0) {
                    for (File file_str : files) {
                        if (isRun == false)
                            return;
                        findApkFile(file_str, onlySize);
                    }
                }
            }
        }
    }

    /**
     * 检查自己的目录下apk TRUE 为正常显示 FALSE 过滤掉 不显示
     */
    private boolean checkOneKeyCleanFiler(String path) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        if (TextUtils.isEmpty(path)) {
            return false;
        }
        if (!(path.contains(filterDir1) || path.contains(filterDir2))) {
            return true;
        }
        JunkChildApk apk = getApkInfoFromPackageInfo(pm, path);
        if (apk.installedType == JunkChildApk.INSTALLED || apk.installedType == JunkChildApk.INSTALLED_OLD) {
            // 已安装 旧版本
            apk.select = 1;
            return true;
        } else {
            // 未安装 新版本 破损
            long currentTime = System.currentTimeMillis();
            if (currentTime - apk.fileTime < ONE_DAY_LONG) {
                return false;
            } else {
                apk.select = 1;
                return true;
            }
        }
    }

    private JunkChildApk getApkInfoFromPackageInfo(PackageManager pm, String str) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        JunkChildApk apk = new JunkChildApk();
        PackageInfo pi = null;
        if (pm != null) {
            pi = pm.getPackageArchiveInfo(str, PackageManager.GET_ACTIVITIES);
        }
        if (pi != null) {
            ApplicationInfo appInfo = pi.applicationInfo;
            /**
             * 获取apk的图标
             */
            Drawable drawable = appInfo.loadIcon(pm);
            apk.icon = drawable;
            /**
             * google 必须加这两行代码才能得到名字和icon
             */
            appInfo.sourceDir = str;
            appInfo.publicSourceDir = str;
            apk.name = (String) appInfo.loadLabel(pm);
            appInfo.loadIcon(pm);
            apk.packageName = pi.packageName;
            apk.versionName = pi.versionName;
            apk.versionCode = pi.versionCode;
            apk.installedType = doType(pm, pi.packageName, pi.versionCode);
        } else {
            apk.name = "未知";
            apk.packageName = "未知";
            apk.versionName = "未知";
            apk.versionCode = 0;
            apk.installedType = JunkChildApk.BREAK_APK;
        }
        if (!TextUtils.isEmpty(str)) {
            apk.fileTime = new File(str).lastModified();
        }
        return apk;
    }

    /**
     * 检查白名单过滤
     *
     * @param path
     * @return
     */
    private boolean checkTrust(String path) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        if (queryAll == null || queryAll.size() == 0 || TextUtils.isEmpty(path)) {
            return false;
        }
        for (TrustMode trustMode : queryAll) {
            if (path.equals(trustMode.path)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 检查手机上是否有此app
     *
     * @param packageName app包名
     * @return
     */
    private boolean checkPackageNameExists(String packageName) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        if (TextUtils.isEmpty(packageName)) {
            return false;
        }
        for (InstalledApp app : collection) {
            if (packageName.equals(app.packageName)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 得到应用缓存选中大小
     */
    private long getCacheSelectSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        long size = 0;
        if (cacheDatas != null && cacheDatas.size() > 0) {
            for (JunkChild child : cacheDatas) {
                if (child instanceof JunkChildCache) {
                    JunkChildCache cache = (JunkChildCache) child;
                    if (JunkChildCache.systemCachePackName.equals(cache.packageName)) {
                        if (cache.getSelect() == 1)
                            size += cache.size;
                    } else {
                        List<JunkChildCacheOfChild> childOfChilds = cache.childCacheOfChild;
                        for (JunkChildCacheOfChild childOfChild : childOfChilds) {
                            if (childOfChild.getSelect() == 1)
                                size += childOfChild.size;
                        }
                    }
                }
            }
        }
        return size;
    }

    /**
     * 得到卸载残留的选中大小
     */
    private long getResidualSelectSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        long size = 0;
        if (residualDatas != null && residualDatas.size() > 0) {
            for (JunkChild child : residualDatas) {
                if (child instanceof JunkChildResidual) {
                    JunkChildResidual residual = (JunkChildResidual) child;
                    if (residual.getSelect() == 1) {
                        size += residual.size;
                    }
                }
            }
        }
        return size;
    }

    /**
     * 得到apk文件的选中大小
     */
    private long getApkFileSelectSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        long size = 0;
        if (apkFileDatas != null && apkFileDatas.size() > 0) {
            for (JunkChild child : apkFileDatas) {
                JunkChildApk apk = (JunkChildApk) child;
                if (apk.getSelect() == 1) {
                    size += apk.size;
                }
            }
        }
        return size;
    }

    /**
     * 得到内存选中的大小
     */
    public long getRAMSelectSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        long size = 0;
        if (ramDatas != null && ramDatas.size() > 0) {
            for (JunkChild child : ramDatas) {
                InstalledAppAndRAM ram = (InstalledAppAndRAM) child;
                if (ram.getSelect() == 1) {
                    size += ram.size;
                }
            }
        }
        return size;
    }

    public long getTotalSelectSize() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        return getCacheSelectSize() + getResidualSelectSize() + getApkFileSelectSize() + getRAMSelectSize();
    }

    public void close() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        if (db.isOpen()) {
            clearManager.closeClearDatabase(db);
            // mInstance=null;
        }
    }

    @Override
    protected void finalize() throws Throwable {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        try {
            if (db != null && db.isOpen()) {
                db.close();
            }
        } finally {
            super.finalize();
        }
    }

    private boolean checkSDState() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        if (TextUtils.isEmpty(sdPath) && TextUtils.isEmpty(outSdPath)) {
            return false;
        }
        return true;
    }

    /**
     * 因为需要回掉 所以方法不进行公开
     *
     * @param path
     * @return
     */
    private long getPathFileSize(String path) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        long fileSizes = 0;
        File file = new File(path.trim());
        try {
            if (null != file && file.exists()) {
                if (file.isDirectory()) {
                    // 如果路径是文件夹的时候
                    fileSizes = getFileFolderTotalSize(file);
                } else if (file.isFile()) {
                    fileSizes = file.length();
                }
            }
            return fileSizes;
        } catch (Throwable th) {
            return fileSizes;
        }
    }

    private long getFileFolderTotalSize(File fileDir) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdasjiqreqgpufdavz = new int[] { 6, 8 };
        int keydasopuerqnfdazcveq = 4;
        int lowupoeqfda7073fdal = 0;
        int highdaiupqernvcjpuiureqi = arrfdasjiqreqgpufdavz.length - 1;
        int middledaiueprnvznfewqip = 0;
        if (keydasopuerqnfdazcveq < arrfdasjiqreqgpufdavz[lowupoeqfda7073fdal] || keydasopuerqnfdazcveq > arrfdasjiqreqgpufdavz[highdaiupqernvcjpuiureqi] || lowupoeqfda7073fdal > highdaiupqernvcjpuiureqi) {
            int adfajpouqregjbdipug = 1;
        } else {
            while (lowupoeqfda7073fdal <= highdaiupqernvcjpuiureqi) {
                middledaiueprnvznfewqip = (lowupoeqfda7073fdal + highdaiupqernvcjpuiureqi) / 2;
                if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] > keydasopuerqnfdazcveq) {
                    // 比关键字大则关键字在左区域
                    highdaiupqernvcjpuiureqi = middledaiueprnvznfewqip - 1;
                } else if (arrfdasjiqreqgpufdavz[middledaiueprnvznfewqip] < keydasopuerqnfdazcveq) {
                    // 比关键字小则关键字在右区域
                    lowupoeqfda7073fdal = middledaiueprnvznfewqip + 1;
                } else {
                }
            }
        }
        long totalSize = 0;
        if (fileDir == null || !fileDir.exists()) {
            return 0;
        } else {
            callCleanActivity(fileDir.getAbsolutePath());
            if (fileDir.isFile()) {
                return fileDir.length();
            } else if (fileDir.isDirectory()) {
                File[] fileList = fileDir.listFiles();
                if (fileList != null) {
                    for (File file : fileList) {
                        if (isRun == false) {
                            return totalSize;
                        }
                        if (FileTreeUtils.isFileDirOver10(file)) {
                            // 深度判断
                            return totalSize;
                        }
                        totalSize += getFileFolderTotalSize(file);
                    }
                }
            }
        }
        return totalSize;
    }

    private void callCleanActivity(Object obj) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        if (obj == null || iScanResult == null) {
        } else {
            if (obj instanceof String) {
                if (System.currentTimeMillis() - lastTime > 200) {
                    lastTime = System.currentTimeMillis();
                    iScanResult.scanning((String) obj);
                }
            } else if (obj instanceof Integer) {
                iScanResult.scanState((Integer) obj);
                if (((Integer) obj) == ScanState.SCAN_ALL_END) {
                    iScanResult = null;
                }
            }
        }
    }

    @Override
    public int describeContents() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdajpoureqofdjaiopuvz80 = new int[] { 1, 5 };
        for (int ireywq097904132784uafds = 1; ireywq097904132784uafds < arrfdajpoureqofdjaiopuvz80.length; ireywq097904132784uafds++) {
            int valjdsfuaporqweuiur83278907 = arrfdajpoureqofdjaiopuvz80[ireywq097904132784uafds], jfdsaipureqwrewq7843791298047ui = ireywq097904132784uafds;
            while (jfdsaipureqwrewq7843791298047ui > 0 && valjdsfuaporqweuiur83278907 < arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1]) {
                arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui - 1];
                jfdsaipureqwrewq7843791298047ui--;
            }
            arrfdajpoureqofdjaiopuvz80[jfdsaipureqwrewq7843791298047ui] = valjdsfuaporqweuiur83278907;
        }
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] numbersfdajipureqvna3280 = new int[] { 2, 3 };
        for (int ifdjaiopurq832074 = 0; ifdjaiopurq832074 < numbersfdajipureqvna3280.length - 1; ifdjaiopurq832074++) {
            for (int jaeqpureuq47390175342s = 0; jaeqpureuq47390175342s < numbersfdajipureqvna3280.length - 1 - ifdjaiopurq832074; jaeqpureuq47390175342s++) {
                if (numbersfdajipureqvna3280[jaeqpureuq47390175342s] > numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1]) {
                    int temphiuyuiyuguhg78779hjk = numbersfdajipureqvna3280[jaeqpureuq47390175342s];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s] = numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1];
                    numbersfdajipureqvna3280[jaeqpureuq47390175342s + 1] = temphiuyuiyuguhg78779hjk;
                }
            }
        }
        dest.writeByte((byte) (isRun ? 1 : 0));
        dest.writeLong(cacheSystemSize);
        dest.writeLong(cacheSize);
        dest.writeLong(residualSize);
        dest.writeLong(apkSize);
        dest.writeLong(ramSize);
        dest.writeString(sdPath);
        dest.writeString(outSdPath);
        dest.writeLong(lastTime);
    }

    public void hadScan(boolean b) {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        this.mHadScan = b;
    }

    public boolean isScanned() {
        int passwordfdare32432qresafdsagda32 = 123456;
        int[] arrfdahiuryeqwfjdasopufdag = new int[] { 9, 4 };
        int lenfdajipureqopufdag = arrfdahiuryeqwfjdasopufdag.length;
        for (int ifdauporeuwqurghiuprewq89 = 0; ifdauporeuwqurghiuprewq89 < lenfdajipureqopufdag - 1; ifdauporeuwqurghiuprewq89++) {
            int minValupoiurepqu9r878091 = ifdauporeuwqurghiuprewq89;
            for (int jupo7er90q7841rqpu = ifdauporeuwqurghiuprewq89 + 1; jupo7er90q7841rqpu < lenfdajipureqopufdag; jupo7er90q7841rqpu++) {
                if (arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] > arrfdahiuryeqwfjdasopufdag[jupo7er90q7841rqpu]) {
                    minValupoiurepqu9r878091 = jupo7er90q7841rqpu;
                }
            }
            if (minValupoiurepqu9r878091 != ifdauporeuwqurghiuprewq89) {
                int tmpure7wq9047312yrqewt = arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89];
                arrfdahiuryeqwfjdasopufdag[ifdauporeuwqurghiuprewq89] = arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091];
                arrfdahiuryeqwfjdasopufdag[minValupoiurepqu9r878091] = tmpure7wq9047312yrqewt;
            }
        }
        return mHadScan;
    }

    /**
     * 扫描回调接口
     */
    public interface IScanResult extends Serializable {

        void scanning(String path);

        void scanState(int state);
    }
}
